package com.atguigu.gulimall.cart.config;

import com.atguigu.gulimall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author 小坏
 * @Date 2021/1/28 15:53
 * @Version 1.0
 * @program: 父工程 gulimall 万物起源之地
 */

@Configuration
public class GulimallWebConfing implements WebMvcConfigurer {

    /**
     * 注册拦截器 CartInterceptor
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册拦截器
        registry.addInterceptor(new CartInterceptor())
                // 拦截路径购物车全部
                .addPathPatterns("/**");
    }
}



